<!doctype html>



  


<html class="theme-next mist use-motion">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />












  
  
  <link href="/vendors/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/vendors/font-awesome/css/font-awesome.min.css?v=4.4.0" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.0.1" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Revision Control," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.0.1" />






<meta name="description" content="说明：Git 与 Github的配置使用。Git进行版本控制，Github属于托管平台。">
<meta name="keywords" content="Revision Control">
<meta property="og:type" content="article">
<meta property="og:title" content="Git and Github">
<meta property="og:url" content="http://bebetter.site/2017/01/12/Software/Revision control and collaborative development 版本控制和协同开发/Git and Github/index.html">
<meta property="og:site_name" content="gatewayzy">
<meta property="og:description" content="说明：Git 与 Github的配置使用。Git进行版本控制，Github属于托管平台。">
<meta property="og:updated_time" content="2017-01-12T05:58:56.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Git and Github">
<meta name="twitter:description" content="说明：Git 与 Github的配置使用。Git进行版本控制，Github属于托管平台。">



<script type="text/javascript" id="hexo.configuration">
  var NexT = window.NexT || {};
  var CONFIG = {
    scheme: 'Mist',
    sidebar: {"position":"right","display":"always"},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: 0,
      author: '博主'
    }
  };
</script>




  <link rel="canonical" href="http://bebetter.site/2017/01/12/Software/Revision control and collaborative development 版本控制和协同开发/Git and Github/"/>

  <title> Git and Github | gatewayzy </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  










  
  
    
  

  <div class="container one-collumn sidebar-position-right page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-meta ">
  

  <div class="custom-logo-site-title">
    <a href="/"  class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <span class="site-title">gatewayzy</span>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>
  <p class="site-subtitle">blog of gatewayzy</p>
</div>

<div class="site-nav-toggle">
  <button>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
  </button>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      

      
    </ul>
  

  
</nav>

 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  
  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                Git and Github
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            <span class="post-meta-item-icon">
              <i class="fa fa-calendar-o"></i>
            </span>
            <span class="post-meta-item-text">发表于</span>
            <time itemprop="dateCreated" datetime="2017-01-12T13:58:19+08:00" content="2017-01-12">
              2017-01-12
            </time>
          </span>

          
            <span class="post-category" >
              &nbsp; | &nbsp;
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope itemtype="https://schema.org/Thing">
                  <a href="/categories/Softwares/" itemprop="url" rel="index">
                    <span itemprop="name">Softwares</span>
                  </a>
                </span>

                
                

              
            </span>
          

          
            
          

          

          
          

          
        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <p><strong>说明：</strong>Git 与 Github的配置使用。Git进行版本控制，Github属于托管平台。<br><a id="more"></a></p>
<h2 id="简介"><a href="#简介" class="headerlink" title="简介"></a>简介</h2><hr>
<ul>
<li>Git属于项目管理软件，类似于SVN(Subversion)实现版本管理。git的目标是取代CSV管理。</li>
<li>Github、OSChina等属于第三方代码托管平台，也可以使用GitLab等自己搭建代码管理平台。这些平台一般都支持Git和svn管理方式。</li>
</ul>
<h2 id="Git使用"><a href="#Git使用" class="headerlink" title="Git使用"></a>Git使用</h2><hr>
<ul>
<li>参考文章：<a href="http://blog.csdn.net/dengsilinming/article/details/8000622" target="_blank" rel="external">Git 常用命令大全</a></li>
</ul>
<h3 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h3><hr>
<ul>
<li>Windows下Git安装：安装git for windows。</li>
<li>ubuntu下安装：apt-get install subversion，使用见svn介绍。</li>
</ul>
<h3 id="远程仓库相关命令"><a href="#远程仓库相关命令" class="headerlink" title="远程仓库相关命令"></a>远程仓库相关命令</h3><hr>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div></pre></td><td class="code"><pre><div class="line">检出仓库：$ git clone git://github.com/jquery/jquery.git</div><div class="line">查看远程仓库：$ git remote -v</div><div class="line">添加远程仓库：$ git remote add [name] [url]</div><div class="line">删除远程仓库：$ git remote rm [name]</div><div class="line">修改远程仓库：$ git remote set-url --push [name] [newUrl]</div><div class="line">拉取远程仓库：$ git pull [remoteName] [localBranchName]</div><div class="line">推送远程仓库：$ git push [remoteName] [localBranchName] </div><div class="line">如果想把本地的某个分支test提交到远程仓库，并作为远程仓库的master分支，或者作为另外一个名叫test的分支，如下：</div><div class="line">$git push origin test:master         // 提交本地test分支作为远程的master分支</div><div class="line">$git push origin test:test              // 提交本地test分支作为远程的test分支</div></pre></td></tr></table></figure>
<h3 id="分支-branch-操作相关命令"><a href="#分支-branch-操作相关命令" class="headerlink" title="分支(branch)操作相关命令"></a>分支(branch)操作相关命令</h3><hr>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div></pre></td><td class="code"><pre><div class="line">查看本地分支：$ git branch</div><div class="line">查看远程分支：$ git branch -r</div><div class="line">创建本地分支：$ git branch [name] ----注意新分支创建后不会自动切换为当前分支</div><div class="line">切换分支：$ git checkout [name]</div><div class="line">创建新分支并立即切换到新分支：$ git checkout -b [name]</div><div class="line">删除分支：$ git branch -d [name] ---- -d选项只能删除已经参与了合并的分支，对于未有合并的分支是无法删除的。如果想强制删除一个分支，可以使用-D选项</div><div class="line">合并分支：$ git merge [name] ----将名称为[name]的分支与当前分支合并</div><div class="line">创建远程分支(本地分支push到远程)：$ git push origin [name]</div><div class="line">删除远程分支：$ git push origin :heads/[name] 或 $ gitpush origin :[name]</div><div class="line">创建空的分支：(执行命令之前记得先提交你当前分支的修改，否则会被强制删干净没得后悔)</div><div class="line">$git symbolic-ref HEAD refs/heads/[name]</div><div class="line">$rm .git/index</div><div class="line">$git clean -fdx</div></pre></td></tr></table></figure>
<h3 id="版本-tag-操作相关命令"><a href="#版本-tag-操作相关命令" class="headerlink" title="版本(tag)操作相关命令"></a>版本(tag)操作相关命令</h3><hr>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line">查看版本：$ git tag</div><div class="line">创建版本：$ git tag [name]</div><div class="line">删除版本：$ git tag -d [name]</div><div class="line">查看远程版本：$ git tag -r</div><div class="line">创建远程版本(本地版本push到远程)：$ git push origin [name]</div><div class="line">删除远程版本：$ git push origin :refs/tags/[name]</div><div class="line">合并远程仓库的tag到本地：$ git pull origin --tags</div><div class="line">上传本地tag到远程仓库：$ git push origin --tags</div><div class="line">创建带注释的tag：$ git tag -a [name] -m &apos;yourMessage&apos;</div></pre></td></tr></table></figure>
<h3 id="子模块-submodule-相关操作命令"><a href="#子模块-submodule-相关操作命令" class="headerlink" title="子模块(submodule)相关操作命令"></a>子模块(submodule)相关操作命令</h3><hr>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">添加子模块：$ git submodule add [url] [path]</div><div class="line">添加子模块如：$git submodule add git://github.com/soberh/ui-libs.git src/main/webapp/ui-libs</div><div class="line">初始化子模块：$ git submodule init  ----只在首次检出仓库时运行一次就行</div><div class="line">更新子模块：$ git submodule update ----每次更新或切换分支后都需要运行一下</div></pre></td></tr></table></figure>
<p>删除子模块：（分4步走）</p>
<ul>
<li>$ git rm –cached [path]</li>
<li>编辑“.gitmodules”文件，将子模块的相关配置节点删除掉</li>
<li>编辑“ .git/config”文件，将子模块的相关配置节点删除掉</li>
<li>手动删除子模块残留的目录 </li>
</ul>
<h3 id="忽略一些文件、文件夹不提交"><a href="#忽略一些文件、文件夹不提交" class="headerlink" title="忽略一些文件、文件夹不提交"></a>忽略一些文件、文件夹不提交</h3><hr>
<p>在仓库根目录下创建名称为“.gitignore”的文件，写入不需要的文件夹名或文件，每个元素占一行即可，如</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">target</div><div class="line">bin</div><div class="line">*.db</div></pre></td></tr></table></figure>
<h3 id="Git其他常用命令"><a href="#Git其他常用命令" class="headerlink" title="Git其他常用命令"></a>Git其他常用命令</h3><hr>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div></pre></td><td class="code"><pre><div class="line">git branch 查看本地所有分支</div><div class="line">git status 查看当前状态 </div><div class="line">git commit 提交 </div><div class="line">git branch -a 查看所有的分支</div><div class="line">git branch -r 查看本地所有分支</div><div class="line">git commit -am &quot;init&quot; 提交并且加注释 </div><div class="line">git remote add origin git@192.168.1.119:ndshow</div><div class="line">git push origin master 将文件给推到服务器上 </div><div class="line">git remote show origin 显示远程库origin里的资源 </div><div class="line">git push origin master:develop</div><div class="line">git push origin master:hb-dev 将本地库与服务器上的库进行关联 </div><div class="line">git checkout --track origin/dev 切换到远程dev分支</div><div class="line">git branch -D master develop 删除本地库develop</div><div class="line">git checkout -b dev 建立一个新的本地分支dev</div><div class="line">git merge origin/dev 将分支dev与当前分支进行合并</div><div class="line">git checkout dev 切换到本地dev分支</div><div class="line">git remote show 查看远程库</div><div class="line">git add .</div><div class="line">git rm 文件名(包括路径) 从git中删除指定文件</div><div class="line">git clone git://github.com/schacon/grit.git 从服务器上将代码给拉下来</div><div class="line">git config --list 看所有用户</div><div class="line">git ls-files 看已经被提交的</div><div class="line">git rm [file name] 删除一个文件</div><div class="line">git commit -a 提交当前repos的所有的改变</div><div class="line">git add [file name] 添加一个文件到git index</div><div class="line">git commit -v 当你用－v参数的时候可以看commit的差异</div><div class="line">git commit -m &quot;This is the message describing the commit&quot; 添加commit信息</div><div class="line">git commit -a -a是代表add，把所有的change加到git index里然后再commit</div><div class="line">git commit -a -v 一般提交命令</div><div class="line">git log 看你commit的日志</div><div class="line">git diff 查看尚未暂存的更新</div><div class="line">git rm a.a 移除文件(从暂存区和工作区中删除)</div><div class="line">git rm --cached a.a 移除文件(只从暂存区中删除)</div><div class="line">git commit -m &quot;remove&quot; 移除文件(从Git中删除)</div><div class="line">git rm -f a.a 强行移除修改后文件(从暂存区和工作区中删除)</div><div class="line">git diff --cached 或 $ git diff --staged 查看尚未提交的更新</div><div class="line">git stash push 将文件给push到一个临时空间中</div><div class="line">git stash pop 将文件从临时空间pop下来</div><div class="line">git remote add origin git@github.com:username/Hello-World.git</div><div class="line">git push origin master 将本地项目给提交到服务器中</div><div class="line">git pull 本地与服务器端同步</div><div class="line">git push (远程仓库名) (分支名) 将本地分支推送到服务器上去。</div><div class="line">git push origin serverfix:awesomebranch</div><div class="line">git fetch 相当于是从远程获取最新版本到本地，不会自动merge</div><div class="line">git commit -a -m &quot;log_message&quot; (-a是提交所有改动，-m是加入log信息) 本地修改同步至服务器端 ：</div><div class="line">git branch branch_0.1 master 从主分支master创建branch_0.1分支</div><div class="line">git branch -m branch_0.1 branch_1.0 将branch_0.1重命名为branch_1.0</div><div class="line">git checkout branch_1.0/master 切换到branch_1.0/master分支</div><div class="line">mkdir WebApp</div><div class="line">cd WebApp</div><div class="line">git init  初始化git工程</div><div class="line">touch README  创建文件</div><div class="line">git add README 添加要提交的文件</div><div class="line">git commit -m &apos;first commit&apos;</div><div class="line">git remote add origin git@github.com:daixu/WebApp.git</div><div class="line">git push -u origin master</div></pre></td></tr></table></figure>
<h2 id="Github使用"><a href="#Github使用" class="headerlink" title="Github使用"></a>Github使用</h2><ul>
<li>创建public库，private需要收费，可以自己搭建gitLab替代github。</li>
<li>maven提交到库中的代码只需要src和pom.xml。</li>
</ul>
<h3 id="本地登录SSH认证"><a href="#本地登录SSH认证" class="headerlink" title="本地登录SSH认证"></a>本地登录SSH认证</h3><hr>
<p>参考文章：<a href="http://jingyan.baidu.com/article/6d704a13171c7428db51cacd.html" target="_blank" rel="external">Git版本管理 本地登录SSH认证</a></p>
<ul>
<li>生成本地ssh公钥。打开git bash终端，输入ssh-keygen -t rsa -C “github账号邮箱地址”。执行前述命令后若成功则会提示在用户文件夹下生成了ssh公钥的文件。是否成功可以通过访问文件夹 .ssh 来确定，若有此文件夹则说明生成成功。</li>
<li>在资源管理器中打开这个.ssh文件夹，在它下面会看到两个文件，选择id_rsa.pub的文件并用记事本打开，复制这个文件中的所有内容。打开浏览器登陆github，在自己的账户面板下找到SSH keys这一栏，打开后即会看到目前该账户下已进行过SSH认证的机器，选择Add SSH key之后，将前一步复制的内容粘贴至Key中，同时需要编辑一个Title来说明此Key认证的是哪一台机器，通常会使用计算机的名字。</li>
<li>保存后，回到git bash中，键入 ssh git@github.com进行连接认证，其中有一步会询问是否确定进行连接，需要键入yes。</li>
<li>在完成认证后，即可将git上的开源项目或自己账号下的私有项目clone到本地。同一台机器（或虚拟机）只需要进行一次SSH认证即可。</li>
</ul>
<h3 id="项目分支"><a href="#项目分支" class="headerlink" title="项目分支"></a>项目分支</h3><hr>
<ul>
<li>需要多人开发时可以使用分支，比如要贡献其他人的项目。</li>
<li>对项目进行fork，自己的repo中就会创建一个分支，对自己repo中的分支进行修改和更新。</li>
<li>自己的repo更新后，点击pull request向原始项目管理人员申请提交。</li>
</ul>
<h3 id="个人分支更新"><a href="#个人分支更新" class="headerlink" title="个人分支更新"></a>个人分支更新</h3><hr>
<h4 id="克隆项目到本地"><a href="#克隆项目到本地" class="headerlink" title="克隆项目到本地"></a>克隆项目到本地</h4><p>由于此时项目只是存在与远程GitHub，所以必须克隆到本地用于开发，执行如下命令即在本地创建了一个项目的克隆。</p>
<ul>
<li><code>git clone https://github.com/username/Spoon-Knife.git</code>    #https方式</li>
<li><code>git clone git@github.com:gatewayzy/importDB.git</code>    #ssh方式</li>
</ul>
<h4 id="配置本地库与原始库的关联"><a href="#配置本地库与原始库的关联" class="headerlink" title="配置本地库与原始库的关联"></a>配置本地库与原始库的关联</h4><hr>
<p>由于克隆后的本地库的只有一个与自己的GitHub上的分支关联的名为origin的远程，所以要提交自己的更新到原始库，必须配置与原始库 <code>https://github.com/octocat/Spoon-Knife</code> 的关联，名为upstream，执行如下：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">cd importDB	#进入本地克隆的项目</div><div class="line">git remote add upstream https://github.com/octocat/Spoon-Knife.git	#添加与原始库的关联，名为upstream</div><div class="line">git fetch upstream	#从原始库上抓取最新更新</div></pre></td></tr></table></figure>
<h4 id="修改代码并提交和PUSH"><a href="#修改代码并提交和PUSH" class="headerlink" title="修改代码并提交和PUSH"></a>修改代码并提交和PUSH</h4><p>修改项目下的README文件作为测试，添加一行“first change.”，提交操作可能需要用户名和密码。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line">git pull #检查远端更新</div><div class="line">git status #查看工程中的文件状态</div><div class="line">git diff filename #查看文件对比</div><div class="line">git add logs/ #将添加logs文件夹下的所有文件 git add –A 表示全部提交</div><div class="line">git commit -a -m &apos;Update README&apos;  #-a表示add，已添加的修改</div><div class="line">git push origin master	#提交push到远程自己的项目分支库</div><div class="line">git fetch upstream	#抓取远程原始库的更新</div><div class="line">git merge upstream/master	#将抓取的更新合并到本地的库中</div></pre></td></tr></table></figure>
<h2 id="问题与解决"><a href="#问题与解决" class="headerlink" title="问题与解决"></a>问题与解决</h2><hr>
<h3 id="强制覆盖本地文件"><a href="#强制覆盖本地文件" class="headerlink" title="强制覆盖本地文件"></a>强制覆盖本地文件</h3><hr>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">git fetch --all  </div><div class="line">git reset --hard origin/master </div><div class="line">git pull</div></pre></td></tr></table></figure>
<h3 id="Git提交无权限"><a href="#Git提交无权限" class="headerlink" title="Git提交无权限"></a>Git提交无权限</h3><hr>
<ul>
<li>问题描述：提交有 <code>fatal: empty ident name (for &lt;pms@yhd-jqhadoop39.int.yihaodian.com&gt;) not allowed</code></li>
<li>解决方法：设置user.email和user.name即可<ul>
<li>$git config –global user.name “ouyangyewei”</li>
<li>$git config –global user.email “ouyangyewei@yhd.com”</li>
</ul>
</li>
</ul>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Revision-Control/" rel="tag">#Revision Control</a>
          
        </div>
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/01/12/OS/Windows/Windows常用配置与软件/" rel="next" title="Windows常用配置与软件">
                <i class="fa fa-chevron-left"></i> Windows常用配置与软件
              </a>
            
          </div>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/01/12/Software/Java Web/SQL NoSQL/" rel="prev" title="SQL NoSQL">
                SQL NoSQL <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    


  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel ">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/statics/images/avatar.png"
               alt="gatewayzy" />
          <p class="site-author-name" itemprop="name">gatewayzy</p>
          <p class="site-description motion-element" itemprop="description">blog website with hexo and github pages</p>
        </div>
        <nav class="site-state motion-element">
          <div class="site-state-item site-state-posts">
            <a href="/archives">
              <span class="site-state-item-count">70</span>
              <span class="site-state-item-name">日志</span>
            </a>
          </div>

          
            <div class="site-state-item site-state-categories">
              <a href="/categories">
                <span class="site-state-item-count">10</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            <div class="site-state-item site-state-tags">
              <a href="/tags">
                <span class="site-state-item-count">38</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
        </div>

        
        

        
        
          <div class="links-of-blogroll motion-element links-of-blogroll-inline">
            <div class="links-of-blogroll-title">
              <i class="fa  fa-fw fa-globe"></i>
              友情链接
            </div>
            <ul class="links-of-blogroll-list">
              
                <li class="links-of-blogroll-item">
                  <a href="https://github.com/gatewayzy" title="Github-gatewayzy" target="_blank">Github-gatewayzy</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://google.com/" title="Goolge" target="_blank">Goolge</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://wiki.jikexueyuan.com/" title="Wiki-jike" target="_blank">Wiki-jike</a>
                </li>
              
            </ul>
          </div>
        

      </section>

      
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">
            
              
            
            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#简介"><span class="nav-number">1.</span> <span class="nav-text">简介</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Git使用"><span class="nav-number">2.</span> <span class="nav-text">Git使用</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#安装"><span class="nav-number">2.1.</span> <span class="nav-text">安装</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#远程仓库相关命令"><span class="nav-number">2.2.</span> <span class="nav-text">远程仓库相关命令</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#分支-branch-操作相关命令"><span class="nav-number">2.3.</span> <span class="nav-text">分支(branch)操作相关命令</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#版本-tag-操作相关命令"><span class="nav-number">2.4.</span> <span class="nav-text">版本(tag)操作相关命令</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#子模块-submodule-相关操作命令"><span class="nav-number">2.5.</span> <span class="nav-text">子模块(submodule)相关操作命令</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#忽略一些文件、文件夹不提交"><span class="nav-number">2.6.</span> <span class="nav-text">忽略一些文件、文件夹不提交</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Git其他常用命令"><span class="nav-number">2.7.</span> <span class="nav-text">Git其他常用命令</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Github使用"><span class="nav-number">3.</span> <span class="nav-text">Github使用</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#本地登录SSH认证"><span class="nav-number">3.1.</span> <span class="nav-text">本地登录SSH认证</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#项目分支"><span class="nav-number">3.2.</span> <span class="nav-text">项目分支</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#个人分支更新"><span class="nav-number">3.3.</span> <span class="nav-text">个人分支更新</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#克隆项目到本地"><span class="nav-number">3.3.1.</span> <span class="nav-text">克隆项目到本地</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#配置本地库与原始库的关联"><span class="nav-number">3.3.2.</span> <span class="nav-text">配置本地库与原始库的关联</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#修改代码并提交和PUSH"><span class="nav-number">3.3.3.</span> <span class="nav-text">修改代码并提交和PUSH</span></a></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#问题与解决"><span class="nav-number">4.</span> <span class="nav-text">问题与解决</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#强制覆盖本地文件"><span class="nav-number">4.1.</span> <span class="nav-text">强制覆盖本地文件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Git提交无权限"><span class="nav-number">4.2.</span> <span class="nav-text">Git提交无权限</span></a></li></ol></li></ol></div>
            
          </div>
        </section>
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2018</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">gatewayzy</span>
</div>

<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Mist
  </a>
</div>

        

        
      </div>
    </footer>

    <div class="back-to-top">
      <i class="fa fa-arrow-up"></i>
    </div>
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  



  
  <script type="text/javascript" src="/vendors/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/vendors/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/vendors/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/vendors/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/vendors/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/vendors/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.0.1"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.0.1"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.0.1"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.0.1"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.0.1"></script>



  



  




  
  

  
  <script type="text/x-mathjax-config">
    MathJax.Hub.Config({
      tex2jax: {
        inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
        processEscapes: true,
        skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      }
    });
  </script>

  <script type="text/x-mathjax-config">
    MathJax.Hub.Queue(function() {
      var all = MathJax.Hub.getAllJax(), i;
      for (i=0; i < all.length; i += 1) {
        all[i].SourceElement().parentNode.className += ' has-jax';
      }
    });
  </script>
  <script type="text/javascript" src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>



  

  
<script type="text/javascript" async src="//push.zhanzhang.baidu.com/push.js">
</script>


</body>
</html>
